﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text.Json.Serialization;
using System.Web;
namespace WebApi_SY.Models
{
    public class sli_work_order
    {
        [Key]
        public int? Id { get; set; }

        public int? Fmeterialid { get; set; } //物料ID
        public string Fbillno { get; set; }   //生产订单号
        public string Forderno { get; set; }   //工作令号

        public string Fnotes { get; set; }   //备注

        public DateTime ? Fdate { get; set; }  //单据日期
        public decimal Fqty { get; set; }  //生产数量
        public decimal Fweight { get; set; }  //重量
        public DateTime ? Fplanstart { get; set; } //计划开始时间
        public DateTime ? Fplanend { get; set; }//计划结束时间
        public string Fordertype { get; set; }//生产订单类型
        public int ? Fforgeqty { get; set; }//合件锻、产品数量合并到表头
        public decimal ? Fforgeweight { get; set; }//合件锻、产品重量合并到表头

        public int? Fstatus { get; set; } //状态

        public string Fname { get; set; }
        public string Fslimetal { get; set; }
        public string Fdescription { get; set; }
        public string Fslidrawingno { get; set; }
        public string Fsliheattreatment { get; set; }
        public string Fsliexplanation { get; set; }


        public virtual ICollection<sli_work_orderEntry> sli_work_orderEntry { get; set; }
    }

    public class sli_work_orderEntry
    {
       
        [Key]
        public int Fentryid { get; set; }

        public int? Id { get; set; }
        public int? Fworkorderlistid { get; set; }
        public int? Fseq { get; set; }
        public int? Fqty { get; set; }
        public int? Fcommitqty { get; set; }
        public int? Forderid { get; set; }
        public int? Forderentryid { get; set; }
        public int? Fstatus { get; set; }
        public int? Fclosed { get; set; }

        public virtual sli_work_order sli_work_order { get; set; }
    }


    public class sli_work_order_view
    {
        [Key]
        public int? Id { get; set; }
        public string Fbillno { get; set; }   //生产订单号
        public DateTime? Fdate { get; set; }  //单据日期
        public decimal? Fqty { get; set; }  //生产数量
        public decimal? Fweight { get; set; }  //重量
        public DateTime? Fplanstart { get; set; } //计划开始时间
        public DateTime? Fplanend { get; set; }//计划结束时间
        public string Fordertype { get; set; }//生产订单类型
        public int? Fentryid { get; set; }
        public virtual ICollection<sli_work_orderprocess_view> sli_work_orderprocess_view { get; set; }
    }

    public class sli_work_orderprocess_view
    {
        [Key]
        public int RowNum { get; set; }  // 主键

        public int Id { get; set; }  // 主键

        public int Fprocessoption { get; set; }  // 工序选项

        public string Foptionname { get; set; }  // 工序选项名称

        public int Fseq { get; set; }  // 工序顺序

        public decimal Fqty { get; set; }  // 数量

        public decimal Fweight { get; set; }  // 重量

        public decimal Fcommitqty { get; set; }  // 提交数量

        public decimal Fcommitweight { get; set; }  // 提交重量

        // 外键关联到主表 sli_work_order_view
        public int WorkOrderId { get; set; }  // 外键字段

        // 导航属性，表示与主表的关系
        public sli_work_order_view sli_work_order { get; set; }
    }


    //生产指令单视图1   原有不做调整，
    public class sli_work_order_view1
    {
        [Key]
        public int? Id { get; set; }

        public int? Fmeterialid { get; set; } //物料ID
        public string Fbillno { get; set; }   //生产订单号
        public string Forderno { get; set; }   //工作令号

        public string Fnotes { get; set; }   //备注

        public DateTime? Fdate { get; set; }  //单据日期
        public decimal Fqty { get; set; }  //生产数量
        public decimal Fweight { get; set; }  //重量
        public DateTime? Fplanstart { get; set; } //计划开始时间
        public DateTime? Fplanend { get; set; }//计划结束时间
        public string Fordertype { get; set; }//生产订单类型
        public int? Fforgeqty { get; set; }//合件锻、产品数量合并到表头
        public decimal? Fforgeweight { get; set; }//合件锻、产品重量合并到表头

        public int? Fstatus { get; set; } //状态

        public string Fname { get; set; }
        public string Fslimetal { get; set; }
        public string Fdescription { get; set; }
        public string Fslidrawingno { get; set; }
        public string Fsliheattreatment { get; set; }
        public string Fsliexplanation { get; set; }


        public virtual ICollection<sli_work_orderEntry_view> sli_work_orderEntry_view { get; set; }
        //public virtual ICollection<sli_work_orders_view> sli_work_orders_view { get; set; }
    }

    public class sli_work_orderEntry_view
    {

        [Key]
        public int Fentryid { get; set; }
        public int Id { get; set; }
        public int Fseq { get; set; } // Assuming this is numeric based on the name
        public int Fworkorderlistid { get; set; }
        public string Fname { get; set; }
        public string Fdescription { get; set; }
        public int Fqty { get; set; } // Changed to decimal for quantit
        public string Fsplittype { get; set; }
        public decimal Fworkweight { get; set; }
        public int Forderid { get; set; }
        public int Forderentryid { get; set; }  

        public string Fproductno { get; set; }
        

        public virtual sli_work_order_view1 sli_work_order_view1 { get; set; }
    }

}